function fig7_2

%  solve IVP using MATLAB routines
%         y' = f(t,y)  with   y(0) = y0
%  where y = (y1, y2, y3 , ..., yn) is an n-vector

clf
% get(gcf)
set(gcf,'Position', [25 1115 658 230])
subaxis(1,1,1,1,'MT',0.01,'MB',0.18,'MR',-0.02,'ML',0.04,'P',0.04)

hold on

for i=1:2
    % time interval
    tmax=30;

    if i==1  % comes close to (0,0)
        y10=2; y20=0;
        y0=[y10 y20];
        i1=28; ii1=i1+1; ar1a=1.5; ar1b=1.3;
        i2=50; ii2=i2+3; ar2a=1.2; ar2b=1.2;
    else   % comes close to (0,0)
        y10=1.518; y20=1;
        y0=[y10 y20];
        i1=8; ii1=i1+1; ar1a=2.5; ar1b=0.9;
        i2=68; ii2=i2+1; ar2a=0.85; ar2b=1.5;
    end

    %  calculate solution using a MATLAB routine
    [t,y] = ode45(@rhs,[0 tmax],y0);
    %[t,y] = ode23s(@rhs,[0 tmax],y0);
    plot(y(:,1),y(:,2),'b','LineWidth',1.1)
    plot(y(1,1),y(1,2),'.b','Markersize',20)
    arrowhead([y(i1,1) y(ii1,1)],[y(i1,2) y(ii1,2)],'b',[ar1a ar1b],3);
    arrowhead([y(i2,1) y(ii2,1)],[y(i2,2) y(ii2,2)],'b',[ar2a ar2b],3);
end

axis([-1.5 2 -2 1]);
% commands to label each axes
grid on
box on
set(gca,'ytick',[-2 -1 0 1])
set(gca,'YTickLabel',{'$-2$';'$-1$';'0';'1'})

ax = gca;
ax.XAxis.TickLabelInterpreter = 'latex';
ax.YAxis.TickLabelInterpreter = 'latex';
set(gca,'FontSize',13)

xlabel('$y$\,-\,axis','Interpreter','latex','FontSize',14)
ylabel('$v$\,-\,axis','Interpreter','latex','FontSize',14)

hold off

%exportgraphics(gca,'/Users/mark/Desktop/fig62.pdf')


%  define f(t,y)
function dy=rhs(t,y)
dy=zeros(2,1);
b=0.25; lam=1;
dy(1) = y(2);
dy(2) = -2*b*y(2) + lam*y(1) - y(1)^3;













